﻿using Dark_Core_Library.DatabaseModules.MongoDB;
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;

namespace DetectWebApi.Models.User
{
    /// <summary>
    /// 用户资料文档
    /// </summary>
    public class UserProfileDocument:DocumentUnit
    {
        /// <summary>
        /// 头像URL
        /// </summary>
        [BsonRepresentation(BsonType.String)]
        [BsonElement("AvatarUrl")]
        public string AvatarUrl { set; get; } = "#";
        /// <summary>
        /// 用户昵称
        /// </summary>
        [BsonElement("NickName")]
        [BsonRepresentation(BsonType.String)]
        public string NickName { set; get; } = "无名氏";
        /// <summary>
        /// 部门
        /// </summary>
        [BsonElement("Department")]
        [BsonRepresentation(BsonType.String)]
        public string Department
        {
            set;
            get;
        } = "无部门";

        /// <summary>
        /// 手机号
        /// </summary>
        [BsonElement("Phone")]
        [BsonRepresentation(BsonType.String)]
        public string Phone { set; get; } = "";

        /// <summary>
        /// 负责项目
        /// </summary>
        [BsonElement("ResponsibleProject")]
        [BsonRepresentation(BsonType.String)]
        public string ResponsibleProject { set; get; } = "无";
        /// <summary>
        /// 用户基本ID
        /// </summary>
        [BsonElement("BasicId")]
        [BsonRepresentation(BsonType.ObjectId)]
        public ObjectId UserId { set; get; }

        /// <summary>
        /// 最后登录时间
        /// </summary>
        [BsonElement("LastLoginTime")]
        [BsonRepresentation(BsonType.DateTime)]
        public DateTime LastLoginTime { set; get; }
        public UserProfileDocument(ObjectId userId)
        {
            this.UserId = userId;
            this.LastLoginTime = CreateTime;
        }

    }
}
